package com.gbx.ximalayating.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.gbx.ximalayating.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class SubscriptionTingSubscriptionFragment extends Fragment implements View.OnClickListener {

    private FragmentManager manager;
    private ListView listView;

    public SubscriptionTingSubscriptionFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_subscription_subscription, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        listView = (ListView) view.findViewById(R.id.subs_subs_list_view);
        LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.subs_empty_container);
        Button button = (Button) linearLayout.findViewById(R.id.subs_empty_btn);
        button.setOnClickListener(this);
        listView.setEmptyView(linearLayout);
        manager = getActivity().getSupportFragmentManager();
    }

    @Override
    public void onClick(View v) {
        ViewPager viewPager = (ViewPager) getActivity().findViewById(R.id.subscription_pager);
        viewPager.setCurrentItem(0);
    }
}
